package com.zzyl.mapper;

import com.github.pagehelper.Page;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectPlanVo;
import com.zzyl.vo.NursingProjectPojo;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @Description NursingPlanMapper
 * @Author huangdongye
 * @Date 2025-05-08  17:04
 */
@Mapper
public interface NursingPlanMapper {
    List<NursingPlanVo> allNursingPlan();

    Page<NursingPlanVo> PageNursingPlan(NursingProjectPojo nursingPlan);
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into nursing_plan values (null,#{sortNo},#{planName},#{status},#{createTime},#{updateTime},#{createBy},#{updateBy},#{remark})")
    void addNursingPlan(NursingPlanVo npv);

    void addNursingProPlan(List<NursingProjectPlanVo> projectPlans);

    NursingPlanVo NursingPlanById(Long id);
    @Delete("delete from nursing_plan where id = #{id}")
    void deleteNursingPlan(Long id);
    @Delete("delete from nursing_project_plan where plan_id = #{id}")
    void deleteNursingProjectPlan(Long id);
    @Update("update nursing_plan set plan_name = #{planName}, update_time = #{updateTime} where id = #{id}")
    void updateNursingPlanById(NursingPlanVo nursingPlan);
    @Update("update nursing_plan set status = #{status} where id = #{id}")
    void updateSwitch(Long id, Integer status);
}
